| Block | Date | aUSD_Karura | aUSD_Acala | aUSD_Total |
|---|---|---|---|---|
| 1216792 | 2021-12-30 | 10,290,227 | 5,817,751 | 16,107,978 |
| 1223729 | 2021-12-31 | 10,091,012 | 5,548,380 | 15,639,391 |
| 1230690 | 2022-01-01 | 10,182,105 | 5,566,857 | 15,748,962 |
| 1237666 | 2022-01-02 | 10,179,270 | 5,310,473 | 15,489,743 |
| 1244636 | 2022-01-03 | 10,093,426 | 5,279,072 | 15,372,498 |
| 1251539 | 2022-01-04 | 9,910,712 | 5,277,526 | 15,188,238 |
| 1258602 | 2022-01-05 | 9,746,031 | 5,246,518 | 14,992,549 |
| 1265574 | 2022-01-06 | 9,752,259 | 5,275,808 | 15,028,068 |
| 1272463 | 2022-01-07 | 9,661,268 | 4,348,873 | 14,010,141 |
| 1279512 | 2022-01-08 | 9,564,227 | 4,370,317 | 13,934,543 |
| 1286513 | 2022-01-09 | 9,557,633 | 4,374,946 | 13,932,579 |
| 1293438 | 2022-01-10 | 9,580,698 | 4,390,869 | 13,971,567 |
| 1300364 | 2022-01-11 | 8,927,325 | 4,373,673 | 13,300,997 |
| 1307287 | 2022-01-12 | 8,992,258 | 4,390,227 | 13,382,485 |
| 1314250 | 2022-01-13 | 9,000,353 | 4,378,522 | 13,378,876 |
| 1321145 | 2022-01-14 | 9,006,750 | 4,377,592 | 13,384,342 |
| 1327988 | 2022-01-15 | 9,010,572 | 4,370,286 | 13,380,858 |
| 1334836 | 2022-01-16 | 8,978,816 | 4,370,286 | 13,349,102 |
| 1341616 | 2022-01-17 | 8,915,504 | 4,370,286 | 13,285,790 |
| 1348556 | 2022-01-18 | 8,954,744 | 4,370,286 | 13,325,030 |
| 1355482 | 2022-01-19 | 8,949,750 | 4,370,286 | 13,320,036 |
| 1362368 | 2022-01-20 | 8,957,900 | 4,370,286 | 13,328,186 |
| 1369220 | 2022-01-21 | 7,868,068 | 4,370,286 | 12,238,354 |
| 1376066 | 2022-01-22 | 6,270,610 | 4,370,286 | 10,640,896 |
| 1382988 | 2022-01-23 | 6,350,365 | 4,370,286 | 10,720,651 |
| 1389889 | 2022-01-24 | 6,048,434 | 4,370,286 | 10,418,720 |
| 1396806 | 2022-01-25 | 5,788,839 | 4,370,286 | 10,159,125 |
| 1403696 | 2022-01-26 | 5,669,633 | 4,370,286 | 10,039,919 |
| 1410563 | 2022-01-27 | 5,508,799 | 4,370,286 | 9,879,086 |
| 1417498 | 2022-01-28 | 5,517,955 | 4,370,286 | 9,888,241 |
| 1424433 | 2022-01-29 | 5,524,636 | 4,370,286 | 9,894,922 |
| 1431336 | 2022-01-30 | 5,509,986 | 4,370,286 | 9,880,272 |
| 1438201 | 2022-01-31 | 5,440,480 | 4,370,286 | 9,810,766 |
| 1445158 | 2022-02-01 | 5,493,135 | 4,370,286 | 9,863,421 |
| 1452085 | 2022-02-02 | 5,462,363 | 4,370,286 | 9,832,649 |
| 1459034 | 2022-02-03 | 5,405,381 | 4,370,286 | 9,775,667 |
| 1465910 | 2022-02-04 | 5,466,083 | 4,370,286 | 9,836,369 |
| 1472341 | 2022-02-05 | 5,421,444 | 4,370,286 | 9,791,730 |
| 1478495 | 2022-02-06 | 5,422,051 | 4,370,286 | 9,792,337 |
| 1484572 | 2022-02-07 | 5,432,589 | 4,370,286 | 9,802,875 |
| 1489375 | 2022-02-08 | 5,330,818 | 4,370,286 | 9,701,105 |
| 1493799 | 2022-02-09 | 5,367,400 | 4,370,286 | 9,737,686 |
| 1498135 | 2022-02-10 | 5,767,842 | 4,370,286 | 10,138,128 |
| 1502412 | 2022-02-11 | 5,650,252 | 4,370,286 | 10,020,538 |
| 1506675 | 2022-02-12 | 5,646,145 | 4,370,286 | 10,016,431 |
| 1510965 | 2022-02-13 | 5,856,542 | 4,370,286 | 10,226,828 |
| 1515339 | 2022-02-14 | 5,841,993 | 4,370,286 | 10,212,279 |
| 1519779 | 2022-02-15 | 5,860,838 | 4,370,286 | 10,231,124 |
| 1524208 | 2022-02-16 | 5,821,150 | 4,370,286 | 10,191,437 |
| 1528534 | 2022-02-17 | 5,721,577 | 4,370,286 | 10,091,863 |
| 1532831 | 2022-02-18 | 5,648,546 | 4,370,286 | 10,018,832 |
| 1537082 | 2022-02-19 | 5,553,868 | 4,370,286 | 9,924,155 |
| 1541290 | 2022-02-20 | 5,281,255 | 4,370,286 | 9,651,541 |
| 1545293 | 2022-02-21 | 5,215,281 | 4,370,286 | 9,585,567 |
| 1549212 | 2022-02-22 | 5,018,519 | 4,370,286 | 9,388,805 |
| 1553133 | 2022-02-23 | 4,970,303 | 4,370,286 | 9,340,589 |
| 1557141 | 2022-02-24 | 4,643,933 | 4,370,286 | 9,014,219 |
| 1561208 | 2022-02-25 | 4,675,561 | 4,370,286 | 9,045,847 |
| 1565186 | 2022-02-26 | 4,676,162 | 4,370,286 | 9,046,448 |
| 1569198 | 2022-02-27 | 4,627,923 | 4,370,286 | 8,998,209 |
| 1573192 | 2022-02-28 | 4,673,425 | 4,370,286 | 9,043,711 |
| 1577360 | 2022-03-01 | 4,728,346 | 4,370,286 | 9,098,632 |
| 1581658 | 2022-03-02 | 4,750,544 | 4,370,286 | 9,120,830 |
| 1586008 | 2022-03-03 | 4,682,114 | 4,370,286 | 9,052,400 |
| 1590339 | 2022-03-04 | 4,617,155 | 4,370,286 | 8,987,442 |
| 1594558 | 2022-03-05 | 4,588,524 | 4,370,286 | 8,958,810 |
| 1598920 | 2022-03-06 | 4,592,027 | 4,370,286 | 8,962,313 |
| 1603233 | 2022-03-07 | 4,572,082 | 4,370,286 | 8,942,369 |
| 1607573 | 2022-03-08 | 4,570,846 | 4,370,286 | 8,941,132 |
| 1611910 | 2022-03-09 | 4,671,687 | 4,370,286 | 9,041,973 |
| 1616357 | 2022-03-10 | 4,568,758 | 4,370,286 | 8,939,045 |
| 1620876 | 2022-03-11 | 4,579,459 | 4,370,286 | 8,949,745 |
| 1625432 | 2022-03-12 | 4,581,608 | 4,370,286 | 8,951,895 |
| 1629884 | 2022-03-13 | 4,537,367 | 4,370,286 | 8,907,654 |
| 1634405 | 2022-03-14 | 4,504,974 | 4,370,286 | 8,875,260 |
| 1638930 | 2022-03-15 | 4,517,668 | 4,370,286 | 8,887,954 |
| 1643457 | 2022-03-16 | 4,550,885 | 4,370,286 | 8,921,171 |
| 1647983 | 2022-03-17 | 4,590,944 | 4,370,286 | 8,961,230 |
| 1652652 | 2022-03-18 | 4,675,263 | 4,370,286 | 9,045,549 |
| 1657396 | 2022-03-19 | 4,724,276 | 4,370,286 | 9,094,562 |
| 1662219 | 2022-03-20 | 4,750,389 | 4,370,286 | 9,120,675 |
| 1666997 | 2022-03-21 | 4,805,186 | 4,370,286 | 9,175,472 |
| 1671509 | 2022-03-22 | 4,827,630 | 4,370,286 | 9,197,916 |
| 1675850 | 2022-03-23 | 4,865,881 | 4,370,286 | 9,236,167 |
| 1680082 | 2022-03-24 | 4,857,238 | 4,370,286 | 9,227,524 |
| 1684322 | 2022-03-25 | 4,869,007 | 4,370,286 | 9,239,293 |
| 1688574 | 2022-03-26 | 4,849,235 | 4,370,286 | 9,219,521 |
| 1692713 | 2022-03-27 | 4,895,435 | 4,370,286 | 9,265,722 |
| 1696873 | 2022-03-28 | 4,930,751 | 4,370,286 | 9,301,037 |
| 1700908 | 2022-03-29 | 5,067,601 | 4,370,286 | 9,437,887 |
| 1704922 | 2022-03-30 | 5,130,914 | 4,370,286 | 9,501,200 |
| 1708906 | 2022-03-31 | 5,239,132 | 4,370,286 | 9,609,418 |
| 1712970 | 2022-04-01 | 5,202,627 | 4,370,286 | 9,572,913 |
| 1717078 | 2022-04-02 | 5,278,899 | 4,370,286 | 9,649,185 |
| 1721276 | 2022-04-03 | 5,282,403 | 4,370,286 | 9,652,689 |
| 1725277 | 2022-04-04 | 5,155,766 | 4,370,286 | 9,526,052 |
| 1729249 | 2022-04-05 | 5,172,532 | 4,370,286 | 9,542,818 |
| 1733105 | 2022-04-06 | 5,083,636 | 4,370,286 | 9,453,922 |
| 1736920 | 2022-04-07 | 5,356,936 | 4,370,286 | 9,727,222 |
| 1740728 | 2022-04-08 | 5,333,274 | 4,370,286 | 9,703,560 |
| 1744511 | 2022-04-09 | 5,305,469 | 4,370,286 | 9,675,755 |
| 1748342 | 2022-04-10 | 5,351,529 | 4,370,286 | 9,721,815 |
| 1752148 | 2022-04-11 | 5,148,440 | 4,370,286 | 9,518,726 |
| 1756009 | 2022-04-12 | 5,168,805 | 4,370,286 | 9,539,092 |
| 1759810 | 2022-04-13 | 5,166,177 | 4,370,286 | 9,536,464 |
| 1763619 | 2022-04-14 | 5,181,003 | 4,370,286 | 9,551,290 |
| 1767375 | 2022-04-15 | 5,225,609 | 4,370,286 | 9,595,895 |
| 1771087 | 2022-04-16 | 5,231,498 | 4,370,286 | 9,601,785 |
| 1774902 | 2022-04-17 | 5,221,374 | 4,370,286 | 9,591,660 |
| 1778708 | 2022-04-18 | 5,204,413 | 4,370,286 | 9,574,699 |
| 1782472 | 2022-04-19 | 5,197,599 | 4,370,286 | 9,567,885 |
| 1786343 | 2022-04-20 | 5,234,624 | 4,370,286 | 9,604,911 |
| 1790294 | 2022-04-21 | 5,315,784 | 4,370,286 | 9,686,070 |
| 1794197 | 2022-04-22 | 5,277,628 | 4,370,286 | 9,647,914 |
| 1798162 | 2022-04-23 | 5,548,256 | 4,370,286 | 9,918,542 |
| 1802115 | 2022-04-24 | 5,465,898 | 4,370,286 | 9,836,184 |
| 1806087 | 2022-04-25 | 5,464,495 | 4,370,286 | 9,834,781 |
| 1810046 | 2022-04-26 | 5,443,354 | 4,370,286 | 9,813,640 |
| 1814021 | 2022-04-27 | 5,414,557 | 4,370,286 | 9,784,844 |
| 1817974 | 2022-04-28 | 5,417,024 | 4,370,286 | 9,787,310 |
| 1821980 | 2022-04-29 | 5,401,302 | 4,370,286 | 9,771,588 |
| 1826039 | 2022-04-30 | 5,325,695 | 4,370,286 | 9,695,981 |
| 1830125 | 2022-05-01 | 5,308,806 | 4,370,286 | 9,679,092 |
| 1834044 | 2022-05-02 | 5,290,063 | 4,370,286 | 9,660,349 |
| 1837991 | 2022-05-03 | 5,289,398 | 4,370,286 | 9,659,685 |
| 1841986 | 2022-05-04 | 5,297,538 | 4,370,286 | 9,667,825 |
| 1846132 | 2022-05-05 | 5,283,745 | 4,370,286 | 9,654,031 |
| 1850190 | 2022-05-06 | 5,288,666 | 4,370,286 | 9,658,953 |
| 1854421 | 2022-05-07 | 5,234,538 | 4,370,286 | 9,604,825 |
| 1858658 | 2022-05-08 | 5,049,196 | 4,370,286 | 9,419,482 |
| 1862992 | 2022-05-09 | 4,856,056 | 4,370,286 | 9,226,343 |
| 1867957 | 2022-05-10 | 4,445,392 | 4,370,286 | 8,815,678 |
| 1873972 | 2022-05-11 | 3,975,273 | 4,370,286 | 8,345,559 |
| 1880188 | 2022-05-12 | 3,790,518 | 4,370,286 | 8,160,804 |
| 1886554 | 2022-05-13 | 3,828,842 | 4,370,286 | 8,199,128 |
| 1892961 | 2022-05-14 | 3,812,935 | 4,370,286 | 8,183,222 |
| 1899371 | 2022-05-15 | 3,856,292 | 4,370,286 | 8,226,578 |
| 1905778 | 2022-05-16 | 3,925,850 | 4,370,286 | 8,296,136 |
| 1912230 | 2022-05-17 | 3,977,072 | 4,370,286 | 8,347,359 |
| 1918591 | 2022-05-18 | 3,942,409 | 4,370,286 | 8,312,696 |
| 1924950 | 2022-05-19 | 3,999,092 | 4,370,286 | 8,369,378 |
| 1931289 | 2022-05-20 | 3,997,746 | 4,370,286 | 8,368,032 |
| 1937640 | 2022-05-21 | 4,028,271 | 4,370,286 | 8,398,557 |
| 1944002 | 2022-05-22 | 4,053,215 | 4,370,286 | 8,423,501 |
| 1950438 | 2022-05-23 | 4,092,102 | 4,370,286 | 8,462,388 |
| 1956833 | 2022-05-24 | 4,104,772 | 4,370,286 | 8,475,059 |
| 1963028 | 2022-05-25 | 4,100,411 | 4,370,286 | 8,470,697 |
| 1969604 | 2022-05-26 | 4,072,206 | 4,370,286 | 8,442,493 |
| 1975998 | 2022-05-27 | 4,055,514 | 4,370,286 | 8,425,800 |
| 1982535 | 2022-05-28 | 4,063,472 | 4,370,286 | 8,433,759 |
| 1988972 | 2022-05-29 | 4,065,723 | 4,370,286 | 8,436,009 |
| 1995443 | 2022-05-30 | 4,075,179 | 4,370,286 | 8,445,465 |
| 2001782 | 2022-05-31 | 4,196,753 | 4,370,286 | 8,567,040 |
| 2008273 | 2022-06-01 | 4,184,512 | 4,370,286 | 8,554,799 |
| 2014698 | 2022-06-02 | 4,192,668 | 4,370,286 | 8,562,954 |
| 2021059 | 2022-06-03 | 4,151,279 | 4,370,286 | 8,521,565 |
| 2027513 | 2022-06-04 | 4,154,170 | 4,370,286 | 8,524,457 |
| 2034053 | 2022-06-05 | 4,166,220 | 4,370,286 | 8,536,507 |
| 2040490 | 2022-06-06 | 4,179,423 | 4,370,286 | 8,549,710 |
| 2046816 | 2022-06-07 | 4,177,516 | 4,370,286 | 8,547,802 |
| 2053305 | 2022-06-08 | 4,178,977 | 4,370,286 | 8,549,264 |
| 2059744 | 2022-06-09 | 4,177,130 | 4,370,286 | 8,547,417 |
| 2066092 | 2022-06-10 | 4,149,014 | 4,370,286 | 8,519,301 |
| 2072325 | 2022-06-11 | 4,102,379 | 4,370,286 | 8,472,665 |
| 2078699 | 2022-06-12 | 4,004,056 | 4,370,286 | 8,374,342 |
| 2084974 | 2022-06-13 | 3,729,152 | 4,370,286 | 8,099,438 |
| 2091245 | 2022-06-14 | 3,735,276 | 4,370,286 | 8,105,563 |
| 2097549 | 2022-06-15 | 3,788,931 | 4,370,286 | 8,159,218 |
| 2103874 | 2022-06-16 | 3,784,345 | 4,370,286 | 8,154,631 |
| 2110292 | 2022-06-17 | 3,780,450 | 4,370,286 | 8,150,736 |
| 2116724 | 2022-06-18 | 3,744,797 | 4,370,286 | 8,115,084 |
| 2123104 | 2022-06-19 | 3,770,456 | 4,370,286 | 8,140,743 |
| 2129497 | 2022-06-20 | 3,773,566 | 4,370,286 | 8,143,853 |
| 2135922 | 2022-06-21 | 3,819,698 | 4,370,286 | 8,189,984 |
| 2142278 | 2022-06-22 | 3,827,112 | 4,370,286 | 8,197,399 |
| 2148575 | 2022-06-23 | 3,829,884 | 4,370,286 | 8,200,170 |
| 2155139 | 2022-06-24 | 3,832,776 | 4,370,286 | 8,203,062 |
| 2161562 | 2022-06-25 | 3,852,269 | 4,370,286 | 8,222,556 |
| 2168013 | 2022-06-26 | 3,876,004 | 4,370,286 | 8,246,290 |
| 2173904 | 2022-06-27 | 3,839,320 | 4,370,286 | 8,209,606 |
| 2178358 | 2022-06-28 | 3,815,712 | 4,370,286 | 8,185,998 |
Please click on the Source Code link at the top of the document to see the full source code. Here is a summary:
---
title: "Acala / Karura aUSD Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
social: menu
source_code: embed
---
```{css custom1, echo=FALSE}
.dataTables_scrollBody {
max-height: 100% !important;
}
```
```{r global, include=FALSE}
library(knitr)
knitr::opts_chunk$set(
message = FALSE,
warning = FALSE,
comment = "#>"
)
library(ggplot2)
# library(dygraphs)
library(kableExtra)
library(formattable)
library(lubridate)
library(flexdashboard)
library(DT)
library(subscanr)
library(formattable)
library(ghql)
x <- GraphqlClient$new()
# Helper function to concat
`%+%` <- function(a, b) paste0(a, b)
window <- today() - as.Date("2021-12-31") + 1
# Liquidity Pool TVL ($3.72M) = totalDefiTvl = totalDexTvl + totalDexLockedTvl + homaLocked + stableCoinTvl
dex <- getDailyPools_acala_dex("karura", window) %>%
setorder(Date, pair)
dailyTVL <- dex[, max(updateAtBlock.id), by = Date] %>%
setnames("V1", "Block")
library(reticulate)
# use_python("/opt/homebrew/bin/python3.9")
```
```{python, include=FALSE}
from substrateinterface import SubstrateInterface
import pandas as pd
def getTotalIssuance(network):
if network=="Karura":
url = 'wss://karura.polkawallet.io'
token = 'KUSD'
else:
url = 'wss://acala-rpc-0.aca-api.network'
token = 'AUSD'
substrate = SubstrateInterface(url)
data = []
for block_id in r.blocks:
hash = substrate.get_block_hash(int(block_id))
ausd = substrate.query(module='Tokens',storage_function='TotalIssuance', params = [{'Token': token}], block_hash = hash)
outi = {"Block": block_id, 'aUSD': ausd.value / 10**12}
data.append(outi)
out = pd.DataFrame(data)
return out
```
```{r tvl, cache = TRUE, include=FALSE}
blocks <- dailyTVL$Block
kusd = py$getTotalIssuance("Karura")
ausd = py$getTotalIssuance("Acala")
dailyTVL <- merge(dailyTVL, kusd, by = "Block") %>%
setnames("aUSD", "aUSD_Karura")
dailyTVL <- merge(dailyTVL, ausd, by = "Block") %>%
setnames("aUSD", "aUSD_Acala")
dailyTVL[, aUSD_Total := aUSD_Karura + aUSD_Acala]
```
# aUSD {.tabset}
Row
----
### Components of Total Value Locked
```{r k_plot1}
dat <- melt(data = dailyTVL[, .(Date, aUSD_Karura, aUSD_Acala)],
id.vars = "Date",
value.name = "aUSD")
dat[, aUSD := aUSD / 1e6]
# Stacked
ggplot(dat, aes(fill=variable, y=aUSD, x=Date)) +
geom_bar(position="stack", stat="identity") +
ggtitle(label="Issuance of aUSD") +
ylab("aUSD (in millions USD)")
```
Row
----
### aUSD Issuance
```{r ausd}
knitr::kable(dailyTVL, escape = FALSE, format.args = list(big.mark = ",")) %>%
kable_styling()
```
Row
----
### Sources and Notes
Please click on the *Source Code* link at the top of the document to see the full source code. Here is a summary:
#### aUSD
- aUDS (or kUSD) obtained from the [py-substrate-interface](https://github.com/polkascan/py-substrate-interface) using function *substrate.query(module='Tokens',storage_function='TotalIssuance', params = [{'Token': 'AUSD'}], block_hash = hash)*